package com.purchase.order.mapper;

import cn.hutool.core.text.StrSpliter;
import com.purchase.manage.damian.*;
import com.purchase.manage.damian.DAO.ProjectQuotationDAO;
import com.purchase.manage.damian.DAO.StoreQuotationDAO;
import com.purchase.manage.damian.VO.OrderAllQuotationVO;
import com.purchase.order.domain.DAO.OrderDAO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;

import java.util.Date;
import java.util.List;

@Mapper
public interface OrderMapper {

    OrderList selectOrder(@Param("orderId")Long orderId);

    //采购员查看发布的订单
    List<OrderDAO> selectreleaseList(@Param("type") String type,@Param("state") String state,@Param("orderId")Long orderId,@Param("name")String name);

    //查看工程类订单详细物资
    List<OrderProjectList> selectReleaseMaterialsListProject(@Param("orderId")Long orderId);

    //查看商品类订单详细物资
    List<StoreQuotationList> selectReleaseMaterialsListOther(@Param("orderId") Long orderId);

    //删除订单
    int deleteOrder(@Param("orderId") Long orderId);

    //查询工程类询价单是否存在的信息
    OrderProject selectQutataion(@Param("orderId")Long orderId,@Param("userId") Long userId);

    //删除供应商上传的工程类询价单
    void deleteQutationProject(@Param("projectId") Long projectId);

    //删除供应商上传的工程类询价单详细物资
    void deleteQutationProjectList(@Param("projectId")Long projectId);

    //查询商品类询价单是否存在的信息
    StoreQuotation selectQutataionOther(@Param("orderId")Long orderId, @Param("userId") Long userId);

    //删除供应商上传的商品类询价单
    void deleteQutationOther(@Param("storeQuotationId")Long storeQuotationId);

    void deleteQutationOtherList(@Param("storeQuotationId") Long storeQuotationId);

    //获取到 招标时间结束的订单
    List<Long> selectChangeStateList(@Param("date") String date);

    //改变招标的订单状态
    void updateState(@Param("ids") List<Long> list);

    //查看招标详情 中 工程类询价单
    List<OrderProject> getQutationProjectInfo(@Param("orderId")Long orderId);

    //查看招标详情 中 工程类询价单全部详细
    List<OrderProject> getQutationProjectInfoAll(@Param("orderId") Long orderId);

    //查看招标详情 中 工程类询价单的物资清单全部详细
    List<OrderProjectList> getQutationProjectListInfoAll(@Param("projectId")Long projectId);

    //查看招标详情 中 商品类询价单
    List<StoreQuotation> getStoreQutationInfo(@Param("orderId")Long orderId);
    //查看招标详情 中 商品类询价单全部详细
    List<StoreQuotation> getStoreQutationInfoAll(@Param("orderId")Long orderId);
    //查看招标详情 中 商品类询价单的物资清单全部详细
    List<StoreQuotationList> getStoreQutationListInfoAll(@Param("storeQuotationId")Long storeQuotationId);

    //更改中标状态
    void updateSuccessBid(OrderList orderList);

    //查看所有订单
    List<OrderDAO> selectAllList(@Param("type") String type,@Param("orderId") Long orderId,@Param("name") String name,@Param("state") String state,@Param("userid") Long userid);

    //供应商查看所有工程询价单
    List<ProjectQuotationDAO> supplierQuotationListProject(@Param("orderId") Long orderId, @Param("name") String name, @Param("userId") Long userId);

    //供应商查看所有商品询价单
    List<StoreQuotationDAO> supplierQuotationListOther(@Param("orderId") Long orderId, @Param("name") String name, @Param("userId") Long userId);

    //商品比价
    List<StoreQuotation> priceComparison(@Param("name")String name);

    //采购员确认收货
    int updateGoodsState(@Param("orderId")Long orderId);

    //供应商查看该类型订单
    List<OrderList> selectList(@Param("type") String type,@Param("ids") String id);

    //采购员可查看某一订单未报价状态的供应商
    List<SysSupplierState> selectStateList(@Param("orderId")Long orderId,@Param("state") String state);

    StoreQuotationList selectMinProduce(@Param("name") String produceName);

    List<StoreQuotationList> selectReleaseMaterialsListOther1(@Param("orderId")Long orderId);

    //可删除
    List<OrderList> selectAllList1(@Param("name")String type);

    //超級管理員查看所有訂單
    List<OrderDAO> selectAll(@Param("type") String type,@Param("orderId") Long orderId,@Param("name") String name,@Param("state") String state,@Param("userid") Long userid);

    //获取该订单的typerids
    String getOrderTypids(@Param("orderid") Long orderId);

    //获取符合条件的供应商
    List<Supplier> getSupplierTypeIds(@Param("orderId") String orderId);

    //统计 是否报价
    int checkState(@Param("orderId")Long orderId,@Param("supplierId") Long supplierId);
}
